<template>
  <div>
    <van-field
      readonly
      label="事件名称"
      type="textarea"
      :autosize="autoSize"
      :value="form.AccidentName"
    >
    </van-field>
    <van-field label="发生日期" :value="form.HappenDate | formatDate" readonly>
    </van-field>
    <van-field
      label="事件地点"
      type="textarea"
      :autosize="autoSize"
      :value="form.Address"
      readonly
    >
    </van-field>
    <van-field readonly label="事件分类">
      <template #input>
        <van-checkbox-group v-model="form.TypeList" direction="horizontal">
          <van-checkbox
            :name="item.ID"
            v-for="(item, index) in form.Types"
            :key="index"
            >{{ item.Name }}</van-checkbox
          >
        </van-checkbox-group>
      </template>
    </van-field>
    <van-field
      label="救援单位/部门"
      :value="form.RescueDepartment"
      type="textarea"
      readonly
    >
    </van-field>
    <van-field
      label="救援人员"
      :value="form.RescuePeople"
      readonly
    >
    </van-field>
    <van-field
      label="救援联系人"
      :value="form.RescueContact"
      readonly
    >
    </van-field>
    <van-field
      label="联系电话"
      :value="form.RescuePhone"
      :autosize="autoSize"
      type="textarea"
      readonly
    >
    </van-field>
    <van-field
      label="事件概况"
      :value="form.Summary"
      type="textarea"
      :autosize="autoSize"
      readonly
    >
    </van-field>
    <van-field label="现场图片" type="textarea" readonly>
      <template #input>
        <eagle-image-preview :images="form.Attachs"></eagle-image-preview>
      </template>
    </van-field>
    <van-field label="录入人" readonly :value="form.CreateChnName">
    </van-field>
    <van-field label="录入时间" readonly :value="form.CreateDate">
    </van-field>
  </div>
</template>

<script>
import { gxNonResponsibilityEmergencyDetail } from "@/api/gx";
export default {
  data() {
    return {
      id: this.$route.query.id,
      autoSize: { minRows: 1 },
      form: {},
    };
  },
  created() {
    this.getDetail();
  },
  methods: {
    getDetail() {
      var me = this;
      let params = { id: this.id };
      gxNonResponsibilityEmergencyDetail(params).then((res) => {
        me.form = res.data;
        me.form.TypeList = me.form.Type == null ? [] : me.form.Type.split(",");
      });
    },
  },
};
</script>
<style scoped="less">
.van-field__control {
  background: #fff;
}
</style>